<script>
function switchtype() {
	var type = $j('#pricetype').val();
	if(type == 1) { $j('#pt-title').html('Cost per kilo'); }
	else if(type == 2) { $j('#pt-title').html('Fixed price'); }
}
function addcond(n) {
	n++;
	$j('#plus').html('<input type="button" class="button rounded" value="+" onclick="addcond(' + n + ')" />');
	$j('#conditions').append('<dl class="four" id="cond-' + n + '"><dt>&nbsp;</dt><dd><input type="text" class="textfield rounded" name="prices[]" /></dd><dd>if they spend more than</dd><dd class="small"><input type="text" class="textfield rounded" name="conditions[]" /></dd><dd id="minus-' + n + '" class="sign"><input type="button" class="button rounded" value="&ndash;" onclick="removecond(' + n + ')" />');
}
function removecond(n) {
	$j('#cond-' + n).remove();
}
</script>
    	<div class="left">
        	<h1>System Settings</h1>
            <div class="bar">

            	<div class="text">Shipping Methods &raquo; Creat New Shipping Method</div>
            	<div class="cr"></div>
            </div>
            <div class="box">
            	<input type="button" class="button rounded" value="Back to Shipping Methods List" onclick="history.go(-1)" />
            </div>
            <hr />
            <form method="post" action="<?=base_url()?>admin/system/addshippingmethod">
            <div class="box bgw">
            	<h3>Basic Information</h3>
                <p class="desc">Please enter following information to create new shipping methods for your shopping cart.</p><br />
                <dl class="two"><dt>Method name</dt><dd><input type="text" class="textfield rounded" name="name" /></dd></dl>
                <dl class="two"><dt>Description</dt><dd><input type="text" class="textfield rounded" name="description" /></dd></dl>
                <dl class="two"><dt>Set as default</dt><dd><input type="checkbox" name="default" /> This shipping method will be chosen as default at check out page</dd></dl>
            	<dl></dl>
            </div>
            <hr />
            <div class="box">
            	<h3>Shipping Cost</h3>
                <dl class="four"><dt>Price type</dt><dd>
                	<select name="price_type" id="pricetype" onchange="switchtype()">
                    	<option value="1">Based of weight</option>
                        <option value="2">Flat rate</option>
                    </select>
                </dd><dd><input type="text" class="textfield rounded" name="price_value" /></dd><dd id="pt-title">Cost per kilo</dd></dl>
                <dl class="four"><dt>&nbsp;</dt><dd><p class="desc">With the set price shipping method you can set 2 parameters. The set price dollar amount and the<br />condition for when this will be applied such as when a user spends more than $50 a set price will be<br /> applied such as $5</p></dd></dl>
                <div id="conditions">
                <dl class="four" id="cond-0"><dt>Add condition</dt><dd><input type="text" class="textfield rounded" name="prices[]" /></dd><dd>if they spend more than</dd><dd class="small"><input type="text" class="textfield rounded" name="conditions[]" /></dd><dd id="plus" class="sign"><input type="button" class="button rounded" value="+" onclick="addcond(0)" /></dd></dl>
                </div>
                <dl></dl>
            </div>
            <hr />
            <div class="box bgw">
             	<h3>Locations</h3>
                <dl class="two"><dt>Available countries</dt><dd>
                	<select name="countries[]" multiple="multiple" size="10" style="height:auto;">
                    <?php foreach($countries as $ct) { ?>
                    	<option value="<?=$ct['id']?>"><?=$ct['name']?></option>
                    <?php } ?>
                    </select>
                </dd></dl>
                <dl></dl>
            </div>
            <hr />
            <div class="box">
                <dl class="two"><dt>&nbsp;</dt><dd><input type="submit" class="button rounded" value="Create method" /></dd></dl>
                <dl></dl>                
            </div>
            </form>
        </div>
        
